package com.thirdgroup.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.thirdgroup.dao.OrderInfoDao;
import com.thirdgroup.dao.impl.OrderInfoDaoImpl;
import com.thirdgroup.pojo.entity.OrderInfo;
import com.thirdgroup.service.OrderPhoneService;
import org.junit.Test;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import static org.junit.Assert.*;

public class OrderInfoServiceImplTest {
   private OrderInfoDao orderInfoDao=new OrderInfoDaoImpl();

    @Test
    public void selectByManagerID() {
//        {"createtime":1641052799000,"customerid":"C20220102112159",
//         "managerid":"M20220102235959","orderid":"O20220101235959",
//          "orderstatus":"活跃中", "packagecost":300.0,"packageid":"A",
//          "paymenttype":"季付","updatetime":1715775782000}
        List<OrderInfo> ms = orderInfoDao.selectByManagerID("M20220102235959");
        String string = JSONObject.toJSONString(ms);
        System.out.println(string);
    }

    @Test
    public void updateState() {
        Date date = new Date();
        // 创建 SimpleDateFormat 对象，指定日期时间格式
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        // 使用 SimpleDateFormat 格式化日期时间
        String formattedDate = formatter.format(date);
        Integer integer = orderInfoDao.updateState("O20220101235959", "活跃中", formattedDate);
        System.out.println(integer);
    }
}